import 'package:flutter/material.dart';
import 'package:flutterdemo/day02/01_statelesswidget.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // 启动要显示的界面
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("图标组件示例"),
      ),
      body: JKHomeContent(),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          print("FloatingActionButton Click");
        },
      ),
    );
  }
}

class JKHomeContent extends StatelessWidget {
  final imageUrl = 'http://image.xcar.com.cn/attachments/a/day_200323/2020032314_59939b0716c40f9be872JrmcP75B4KfO.jpg-app';
  @override
  Widget build(BuildContext context) {
    return Image.asset("assets/images/iron.png");
    //return Image.network("http://image.xcar.com.cn/attachments/a/day_200323/2020032314_59939b0716c40f9be872JrmcP75B4KfO.jpg-app");
//    return Image(
//      image: NetworkImage(imageUrl),
//      width: 200,
//      height: 200,
//      // 宽度固定，高度自适应
//      fit: BoxFit.fitHeight,
//      // 范围 -1 到 1
//      alignment: Alignment(0, 0),
//    );
  }
}

